package com.tarena.lbs.basic.web.controller;

import com.tarena.lbs.base.protocol.model.Result;
import com.tarena.lbs.basic.web.assemble.TagAccessmbler;
import com.tarena.lbs.pojo.basic.vo.ArticleItemTag;
import com.tarena.lbs.pojo.basic.vo.UserItemTag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
public class TagController {
    @Autowired
    private TagAccessmbler accessmbler;

    //新增文章.内容标签查询
    @GetMapping("/basic/tagLibrary/info/articleAllList")
    public Result<Map<String, List<ArticleItemTag>>> atticleTags(){
        Map<String, List<ArticleItemTag>> stringListMap = accessmbler.assembleArticleTags();
        return new Result<>(stringListMap);
    }

    @GetMapping("/basic/tagLibrary/info/articleList")
    public Result<Map<String, List<ArticleItemTag>>> articleTagsList(){
        Map<String, List<ArticleItemTag>> stringListMap = accessmbler.assembleArticleTags();
        return new Result<>(stringListMap);
    }

    @GetMapping("/basic/tagLibrary/info/userList")
    public Result<Map<String,List<UserItemTag>>> userTag(){
        log.debug("获取用户登录标签");
        Map<String, List<UserItemTag>> stringListMap = accessmbler.assembleUserTags();
        return new Result<>(stringListMap);
    }

    @GetMapping("/admin/basic/tagLibrary/info/userList")
    public Result<Map<String, List<UserItemTag>>> userTages(){
        Map<String, List<UserItemTag>> stringListMap = accessmbler.assembleUserTags();
        return new Result<>(stringListMap);
    }
}
